

/**the results form this code produces the results in the paper as of 9/26/2011/**
**however they need to use the new data file that has membership on the foreign affaris committee**



**code for assault weapons ban cosponsorhip data****

use "C:\0.bens office computer\g\salience paper\House.110th.6.29.09.dta", replace

***these codes are designed to make three tables and two figures***
*** first, compare the influences on the AWB before and after va tech***
***second create an appendix of all of the alternative models****
***third, create a figure that compares distrcit liberalism as an influence before and after va tech******
***fourth, create a table that comapres  cosposnsorship on awb to that on the genocide recognition****
***fifth, calculate pred probabilities for district liberalism in awb VS AGR 5****

**this code flips the coding on the cosponsorship vairable pre the va tech shooting because the only people who changed added cosponsorship from not,**
** unlike with the armenian genocide where people withdrew cosponship after addingso 0 indicates cosponsorship and 1 indicates not**
**this allows the heckman probit to run**


generate invprevt=.
replace invprevt=1 if awbCOpreVT ==0
replace invprevt=0 if awbCOpreVT ==1


generate invpostvt=.
replace invpostvt=1 if awbCOpostVT==0
replace invpostvt=0 if awbCOpostVT==1


generate noofcospby10=nofcosppc/10

generate netAGRcosp=cosponsor-withdrawal
**this makes an indicator of withdrawal that is scored as continued support so that the pre and post coefficients are signed the same***
**this facilitates comparison across the models***

generate wcosponsor=.
replace wcosponsor=1 if withdrawal2==0
replace wcosponsor=0 if withdrawal2==1


*********************************************************************************************
*******************************************Table 1 ******************************************
**since rho is not significant we run a rare events logit************************************
*********************************************************************************************
relogit   cosponsor armturkpc gop veteranpc  dist_liberal ada_score competitiveness  noofcospby10 
  outreg using table1, se bdec(2) coefastr nolabel 3aster replace

relogit   withdrawal2 armturkpc gop veteranpc  dist_liberal ada_score competitiveness noofcospby10 if cosponsor ==1
		outreg using table1, append se bdec(2) coefastr nolabel 3aster   

relogit awbCOpreVT owngun    secwarpct04 awban ada_score competitiveness noofcospby10 
  outreg using table1, append se bdec(2) coefastr nolabel 3aster 
relogit awbCO owngun    secwarpct04 awban  ada_score competitiveness  noofcospby10 if awbCOpreVT==0

  outreg using table1, append se bdec(2) coefastr nolabel 3aster  


type table1.out


**I ran this to test whether the lack of stat sig is a function of too few observations****
**naive model ***
relogit   cosponsor  dist_liberal 
outreg using AppendixB, append se bdec(2) coefastr nolabel 3aster 

relogit   withdrawal2   dist_liberal  if cosponsor ==1
outreg using AppendixB, append se bdec(2) coefastr nolabel 3aster 


**********************************************************************************************
*********************************Table 2******************************************************
***this makes a table comparing the overall influences on the armenian genocode to the AWB****
**********************************************************************************************
relogit   netAGRcosp armturkpc gop veteranpc  dist_liberal ada_score competitiveness  noofcospby10 
outreg using table2, se bdec(2) coefastr nolabel 3aster replace

relogit awbCO owngun secwarpct04 awban ada_score competitiveness  noofcospby10 

outreg using table2, append se bdec(2) coefastr nolabel 3aster  

type table2.out


*************************************************************
****permutations upadated for appendix B using rare events***
*************************************************************

***this is the heckman model, but the rho was insig so we follow it with rare events logit*******

heckprob withdrawal2 armturkpc gop veteranpc  dist_liberal ada_score competitiveness , select(cosponsor=  armturkpc  gop veteranpc  dist_liberal ada_score competitiveness  noofcospby10 )
outreg using AppendixB, se bdec(2) coefastr nolabel 3aster addstat(log-likelihood, e(ll)) replace

**dwnom***
relogit cosponsor armturkpc gop veteranpc  dist_liberal dwnom1 competitiveness noofcospby10 
outreg using AppendixB, append se bdec(2) coefastr nolabel 3aster 

relogit withdrawal2 armturkpc gop veteranpc  dist_liberal dwnom1 noofcospby10 competitiveness if cosponsor==1
outreg using AppendixB, append se bdec(2) coefastr nolabel 3aster 

**prez vote share***
relogit cosponsor armturkpc gop veteranpc  repvs_04 ada_score competitiveness noofcospby10 
outreg using AppendixB, append se bdec(2) coefastr nolabel 3aster 

relogit withdrawal2 armturkpc gop veteranpc repvs_04 ada_score competitiveness noofcospby10 if cosponsor==1
outreg using AppendixB, append se bdec(2) coefastr nolabel 3aster 

**dw nominate AND prez vote share***
relogit cosponsor armturkpc gop veteranpc  repvs_04 dwnom1 competitiveness noofcospby10 
outreg using AppendixB, append se bdec(2) coefastr nolabel 3aster 

relogit  withdrawal2 armturkpc gop veteranpc  repvs_04 dwnom1 competitiveness noofcospby10 if cosponsor==1
outreg using AppendixB, append se bdec(2) coefastr nolabel 3aster 

**naive model ***
relogit   cosponsor  dist_liberal 
outreg using AppendixB, append se bdec(2) coefastr nolabel 3aster 

relogit   withdrawal2   dist_liberal  if cosponsor ==1
outreg using AppendixB, append se bdec(2) coefastr nolabel 3aster 


**additive model of armenains and turks*****
relogit cosponsor armenian turk gop veteranpc  dist_liberal dwnom1 competitiveness noofcospby10 
outreg using AppendixB, append se bdec(2) coefastr nolabel 3aster 

relogit withdrawal2 armenian turk gop veteranpc  dist_liberal dwnom1 competitiveness noofcospby10 if cosponsor==1
outreg using AppendixB, append se bdec(2) coefastr nolabel 3aster 

type AppendixB.out



*******************************************************
****code for appendix c which has the awb appendix*****
*******************************************************

heckprob invpostvt owngun secwarpct04 dist_liberal  ada_score competitiveness , select( invprevt = owngun secwarpct04  ada_score dist_liberal competitiveness noofcospby10 )
outreg using AppendixC, se bdec(2) coefastr nolabel 3aster addstat(log-likelihood, e(ll), Rho, e(rho)) replace

** dnominate scores**
 relogit  awbCOpreVT owngun    secwarpct04   dwnom1 dist_liberal competitiveness  noofcospby10 
   outreg using AppendixC, append se bdec(2) coefastr nolabel 3aster  
 relogit  awbCO owngun    secwarpct04   dwnom1 dist_liberal competitiveness  noofcospby10 if awbCOpreVT==0
   outreg using AppendixC, append se bdec(2) coefastr nolabel 3aster  

**prez vote share***
 relogit awbCOpreVT owngun    secwarpct04  repvs_04  ada_score competitiveness noofcospby10 
   outreg using AppendixC, append se bdec(2) coefastr nolabel 3aster  
  relogit awbCO owngun    secwarpct04 repvs_04  ada_score competitiveness  noofcospby10 if awbCOpreVT==0
   outreg using AppendixC, append se bdec(2) coefastr nolabel 3aster  

**nominate and prez vote share**
 relogit awbCOpreVT owngun    secwarpct04  repvs_04  dwnom1 competitiveness noofcospby10 
   outreg using AppendixC, append se bdec(2) coefastr nolabel 3aster  
 relogit awbCO owngun    secwarpct04  repvs_04  dwnom1 competitiveness noofcospby10 if awbCOpreVT==0
   outreg using AppendixC, append se bdec(2) coefastr nolabel 3aster  

**using District Liberalism fom the NAES***
relogit awbCOpreVT owngun secwarpct04 dist_liberal  ada_score competitiveness noofcospby10 
  outreg using AppendixC, append se bdec(2) coefastr nolabel 3aster  
relogit awbCO owngun secwarpct04 dist_liberal  ada_score competitiveness  noofcospby10 if awbCOpreVT==0 
  outreg using AppendixC, append se bdec(2) coefastr nolabel 3aster  

type AppendixC.out


***********************************************************************************************
**************Appendix D robustness tests for table 2 results**********************************
***********************************************************************************************

***Assault Weapons Ban Models****
				*********2004 GOP distrcit vote share***********
	relogit  awbCO owngun  secwarpct04   awban dwnom1 competitiveness  noofcospby10 
   outreg using AppendixD, se bdec(2) coefastr nolabel 3aster replace


 					*******district liberalism for AWB********
relogit awbCO owngun secwarpct04 dist_liberal ada_score competitiveness  noofcospby10 
   outreg using AppendixD, append se bdec(2) coefastr nolabel 3aster  

				

					*********dwnominate***********
 	relogit  awbCO owngun  secwarpct04   repvs_04 ada_score competitiveness  noofcospby10 
   outreg using AppendixD, append se bdec(2) coefastr nolabel 3aster  

**Armenian Genocide Models***

					*********dwnominate***********
 	relogit   netAGRcosp armturkpc veteranpc  dist_liberal gop dwnom1  competitiveness  noofcospby10 
   outreg using AppendixD, append se bdec(2) coefastr nolabel 3aster  

					*********2004 GOP district vote share***********
	relogit netAGRcosp armturkpc veteranpc  repvs_04 gop ada_score  competitiveness  noofcospby10 
   outreg using AppendixD, append se bdec(2) coefastr nolabel 3aster  


type AppendixD.out
